#include <iostream>
#include<list>
using namespace std;

void printLots(const list<int> & llist, const list<int> & plist)
{
    list<int>::const_iterator itr_p = plist.begin();
     list<int>::const_iterator itr_l = llist.begin();

    int lpos = 0;

    for(; itr_p != plist.end() && itr_l != llist.end() ; ++itr_l)
    {
        /*match p's position: print element and move to next p's position*/


        if(lpos == *itr_p)
        {
            cout << "pos: " << lpos << endl;
            cout << *itr_l << endl;
            ++itr_p;
        }
        /**/
        else {



        }
        lpos++;
    }

}

void listmemset(list<int>& mylist, int n)
{
    for(int i = 0; i < n; ++i)
    {
        mylist.push_back(i);
    }
}


int main()
{
    list<int> llist;
    list<int> plist;

    listmemset(llist, 8);

    plist.push_back(0);
    plist.push_back(3);


    printLots(llist,plist);


    return 0;
}
